<?php

declare(strict_types=1);

namespace App\Model;

use Hyperf\DbConnection\Model\Model;

/**
 *  App\Models\CallbackLogAogra
 *  声网回调模型
 */
class CallbackLogAogra extends Model
{
    protected $table = 'callback_log_agora';

    /**
     * 加入日志
     */
    static function addRecord(
        $channelId = '',
        $msgType = 0,
        $uid = 0,
        $callbackArr = '',
        $callType = 0
    ) {
        if (!$uid || !$channelId) return 0;
        $model = new self();
        $model->channel_id = $channelId;
        $model->uid = $uid;
        $model->msg_type = $msgType;
        $model->detail = $callbackArr;
        $model->call_type = $callType;
        return $model->saveOrFail() ? 1 : 0;
    }
}
